prefix = '../../build/bin/mesh';
X = importdata([prefix '.x']); minx = min(X); maxx = max(X);
Y = importdata([prefix '.y']); miny = min(Y); maxy = max(Y);
%Z = importdata([prefix '.z']); 
C = importdata([prefix '.class']); 
d = importdata([prefix '.d']);
%maxz = max(Z) * ones(size(d,1),1);
maxc = max(C) * ones(size(d,1),1);
b = importdata([prefix '.b']);

N = sqrt(length(X));
X = reshape(X, N, N);
Y = reshape(Y, N, N);
%Z = reshape(Z, N, N);
C = reshape(C, N, N);

az = 0;
el = 90;

% subplot(1,2,1)
% hold on
% surf(X,Y,Z,'EdgeColor','none','FaceColor','interp','FaceLighting','phong')
% plot3(d(:,1), d(:,2), maxz, '.w');
% hold off
% view(az, el);
% axis([minx maxx miny maxy])
% axis square
% 
% subplot(1,2,2)
figure
hold on
surf(X,Y,C,'EdgeColor','none','FaceColor','interp','FaceLighting','phong')
plot3(d(:,1), d(:,2), maxc, '.w');
hold off
view(az, el);
axis([minx maxx miny maxy])
axis square

figure
subplot(1,2,1)
bar(b(:,1))
subplot(1,2,2)
bar(b(:,2))
